<%--
  Created by IntelliJ IDEA.
  User: dell
  Date: 2021/7/29
  Time: 15:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="static/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="static/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="static/css/animate.min.css" rel="stylesheet">
    <link href="static/css/myAlert.css" rel="stylesheet">
    <link href="static/css/style.min.css?v=4.0.0" rel="stylesheet"><base target="_blank">
</head>
<body>
<div style="width: 60%;margin-left: 20%;margin-top: 10%" class="project">
    <h2 style="text-align: center ;color: #07c227">项目列表</h2>
    <table class="table table-hover" >
        <thead>
        <tr >
            <th>项目名称</th>
            <th>项目编号</th>
            <th>申报单位</th>
            <th>项目类型</th>
            <th>负责人</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody class="first">
        </tbody>
    </table>
</div>
<script src="static/js/jquery.min.js?v=2.1.4"></script>
<script src="static/js/bootstrap.min.js?v=3.3.5"></script>
<script src="static/js/plugins/iCheck/icheck.min.js"></script>
<script src="static/js/myAlert.js"></script>
<script src="static/js/jquery.form.min.js"></script>
<script>
    $(function (){
        $.ajax({
            url:"findMyProject",
            type:"post",
            success:function (data){
                for (let i = 0; i < data.length; i++) {
                    $(".first").append(" <tr><td id='pid'>"+data[i].pid+"</td><td>"+data[i].pname+"</td><td>"+data[i].pcode+"</td><td>"+data[i].punit+"</td>" +
                        " <td >"+data[i].pdirector+"</td> <td>"+data[i].ptype+"</td>" +
                        "<td><input type='button' class='btn btn-w-m btn-success add' value='申请验收'/>" +
                        "</td> </tr>")
                }
                var malert= {
                    title: "Tip",
                    msg: "操作成功",
                }
                $(".add").click(function (){
                    let pid= $(this).parents("tr").find("#pid").text()
                    $.ajax({
                        url:"toCheck",
                        type: "post",
                        data:{pid:pid}
                    })
                    MyAlert(malert);
                })
            }
        })
    })
</script>
</body>
</html>
